<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<script type="text/javascript" src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.easyui.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/js/jquery-easyui-1.5.5.6/locale/easyui-lang-zh_CN.js"/>"></script>
<link rel="stylesheet" href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/icon.css"/>"/>
<link rel="stylesheet" href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/default/easyui.css"/>"/>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<script type="text/javascript">
$(function(){
	//去新增
	$('.xinz_ygzttable').linkbutton({onClick:function(){
		$(".yglz-wdm-ygzttables").panel({
			href:'to_ygzttable_add'
		});	
	}});
	//编辑
	$('.jz_ygzttable').linkbutton({onClick:function(){
		var rowInfo = $("#yglz-wdm-ygzttable").datagrid('getSelected');
		if(rowInfo){
					
					var ygztId = $("#yglz-wdm-ygzttable").datagrid("getSelected").ygztId;
						$(".yglz-wdm-ygzttables").panel({
							href:'id_ygzttable?ygztId='+ygztId
						});	
				
		}else{
			$.messager.alert('错误', '对不起，操作失败，没有选中的行');
		}
		
	}}); 
	
	
	//删除
	$(".sc_ygzttable").linkbutton({onClick:function(){
		var rowInfo = $("#yglz-wdm-ygzttable").datagrid('getSelected');
		if(rowInfo){
			 $.messager.confirm('确认', '您确定要删除该条数据吗？', function(v){
				if(v){
					
					var ygztId = $("#yglz-wdm-ygzttable").datagrid("getSelected").ygztId;
					  $.getJSON("delete_ygzttable",{ygztId:ygztId},function(v){
						if(v){
							$('#yglz-wdm-ygzttable').datagrid('reload');   
						}else{
							$.messager.alert('错误', '对不起，操作失败，原因：' + v.message);
						}
					});  
				}
				
			}); 
		}else{
			$.messager.alert('错误', '对不起，操作失败，没有选中的行');
		}
		
	}});
	
	
	
});

</script>
	<div class="easyui-panel yglz-wdm-ygzttables" data-options="fit:true">
	<table  class="easyui-datagrid yglz-wdm-ygzttable" id="yglz-wdm-ygzttable" data-options="
				url:'queryByto_ygzttable',
				pageList:[2,4,6,8,10],
				pageSize:10,
				pagination:true,
				method:'get',
				fitColumns:true,
				fit:true,
				nowrap:false,
				autoRowHeight:true,
				singleSelect:true,
				striped:true,
				toolbar:'#www-ygzttable'
				">
			<thead>
				<tr>
					<th data-options="field:'ygztId',width:50,align:'center'">用工状态变动编号</th>
					<th data-options="field:'stainId',width:50,align:'center'">员工编号</th>
					<th data-options="field:'stainName',width:50,align:'center'">员工名称</th>
					<th data-options="field:'ygztDate',width:50,align:'center',
							formatter:function(value,row,index){
							var date = new Date(value);
							return date.toLocaleString();
					}">变动日期</th>
					<th data-options="field:'jobsName',width:50,align:'center'">新状态</th>
					<th data-options="field:'ygztBeizhu',width:50,align:'center'">备注</th>
					<th data-options="field:'ygztPerson',width:50,align:'center'">制单人</th>
					<th data-options="field:'ygztStartdate',width:50,align:'center',
							formatter:function(value,row,index){
							var date = new Date(value);
							return date.toLocaleString();
					}">制单日期</th>
				</tr> 
			</thead>
			<tbody>
			</tbody>
		</table>
		<div  id="www-ygzttable">
				<a href="#" class="easyui-linkbutton  xinz_ygzttable" data-options="iconCls:'icon-add',plain:true,text:'新增',iconAlign:'left'"></a>| 
                <a href="#" class="easyui-linkbutton jz_ygzttable" data-options="iconCls:'icon-edit',plain:true,text:'编辑',iconAlign:'left'"></a>| 
                <a href="#" class="easyui-linkbutton sc_ygzttable"  data-options="iconCls:'icon-remove',plain:true,text:'删除',iconAlign:'left'"></a>| 
				搜索内容<input id="sswdm" class="easyui-searchbox sswdm"
						 prompt="请输入员工名"
						style="width: 200px; vertical-align:middle;"></input> 
		</div>
		
	</div>
</body>
</html> 